package com.juxing.service.accountCenter.dao.impl;

import org.springframework.stereotype.Repository;

import com.juxing.service.accountCenter.bean.UserAccountBean;
import com.juxing.service.accountCenter.bean.UserIdKeyBean;
import com.juxing.service.accountCenter.dao.IUserAccountDao;

@Repository
public class UserAccountDaoImpl extends AbstractBaseDao implements IUserAccountDao {

	@Override
	public int generateUserId() {
		UserIdKeyBean bean = new UserIdKeyBean();
		bean.setCreateOn(System.currentTimeMillis());
		this.insert("UserAccount.generateId", bean);
		return bean.getId();
	}

	@Override
	public int insert(UserAccountBean bean) {
		return this.insert("UserAccount.insert", bean);
	}
	
	@Override
	public UserAccountBean queryByUserId(int userId) {
		return this.selectOne("UserAccount.queryByUserId", userId);
	}
	
	@Override
	public int updatePassword(UserAccountBean bean) {
		return this.update("UserAccount.updatePassword", bean);
	}

	@Override
	public int updateAccessToken(UserAccountBean bean) {
		return this.update("UserAccount.updateAccessToken", bean);
	}

}
